home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 020a / piclb183.zip / PICLAB.DOC < prev    next >
Text File  |  1991-10-07  |  39KB  |  1,080 lines

  1. PICLAB.DOC
  2. October 8, 1991
  3.  
  4. Piclab 1.83 is a public domain image processing program by Lee
  5. Daniel Crocker and the Stone Soup Group.  It should be distributed
  6. with the following files:
  7.  
  8. PL.EXE          The program itself.
  9. PL286.EXE       Faster, smaller version for 286 (and up) machines.
  10. PL.HLP          Text file for the HELP command.
  11. PICLAB.DOC      This file.
  12. GAMMA1.MAP  \
  13. GAMMA2.MAP   X  Color maps for viewing grayscale and pseudo-color.
  14. PSEUDO.MAP  /
  15. SSTOOLS.SMP     Sample SSTOOLS.INI file.
  16.  
  17. If you are missing one or more of these files, contact the author
  18. at one of the addresses listed at the end of this document.
  19.  
  20.  
  21.  
  22. Overview
  23. ========
  24.  
  25. Piclab operates on "images", so I will begin by explaining exactly
  26. what an image is and how Piclab classifies them.
  27.  
  28. For our purposes, an image is a data set that describes
  29. the reflectance of a 2-dimensional surface such as a photograph.  In
  30. particular, an image is a 2-dimensional array of "pixels" (a short
  31. form of "picture elements"), each of which contains data for the
  32. small rectangular area of the image it represents.
  33.  
  34. There are many systems in which image data represents "objects"
  35. rather than pixels.  PostScript is probably the most notable example. 
  36. The commands sent to a PostScript device tell it to draw lines or
  37. boxes or characters and let the device decide how it will perform the
  38. commands it gets.  Piclab does not deal with object-based images or
  39. devices.
  40.  
  41. Image data comes in several flavors, and while all are related in
  42. many ways, there are distinctions important to keep in mind.  I will
  43. divide image data into four classes: bitmapped, grayscale,
  44. golor-mapped, and true-color.  In all of these formats an image is
  45. represented as a rectangular array of pixels, each of which may
  46. contain some value.
  47.  
  48. Bitmapped images are collections of on/off dots.  That is, each pixel
  49. can be either "on" or "off", with no states in between.  This type of
  50. image can be displayed on just about any type of computer and is
  51. especially suited to printer output.  The disadvantages are the
  52. inability to represent color, and the lack of detail.  With large
  53. bitmapped images, one can get a surprising amount of detail by
  54. simulating shades of gray by dot patterns.  This process, called
  55. halftoning, is used by newspapers to print photographs.
  56.  
  57. At this time, Piclab does not deal directly with bitmapped images,
  58. although it can treat them as grayscale and can output images to
  59. bitmapped devices.
  60.  
  61. Grayscale images represent images by storing the intensity of light
  62. for each pixel on a scale of more than just on/off.  Typically, a
  63. grayscale image will allow 64 to 256 shades of gray at each pixel. 
  64. Very high quality renderings of black and white photographs can be
  65. stored in this format.
  66.  
  67. As an aside, the term "black and white" is often used to describe
  68. both bitmapped images and grayscale images.  For this reason, I will
  69. not use the term in this document.  Another common term for grayscale
  70. is "monochrome", which is often used to describe monitors that can
  71. display only shades of one color (often green or amber).
  72.  
  73. Color-mapped images are the ones most common on personal computers.
  74. Each pixel in an image is represented by a number (called an index)
  75. that is used to look up the pixel's actual color in a table (called
  76. the palette, much like an artist's palette).  These images are
  77. popular because they can be very colorful, yet take up less memory
  78. than full-color images (described next).  The size of the color
  79. palette varies among formats, but is typically 16 to 256.
  80.  
  81. True-color images are the highest quality representation, and the
  82. largest files as well.  Each pixel contains the complete color
  83. information for that pixel, usually expressed as the intensity of the
  84. red, green, and blue color components of the light at that location.
  85.  
  86. Piclab deals directly with grayscale, color-mapped and true-color
  87. images, regardless of the display capabilities of the hardware on
  88. which it is running.  In fact, Piclab can be used to enhance and
  89. print images on machines with no display at all.
  90.  
  91. I must stress that there is no connection between the images
  92. Piclab deals with and the type of display on your computer.  Piclab
  93. has a SHOW command that displays the image it is working with, but if
  94. the image is more detailed than your display can handle, Piclab will
  95. do its best to approximate the image on your display.  Regardless of
  96. what the display looks like, the image itself is always stored and
  97. operated upon in full detail.
  98.  
  99. So what's the point?  You might think that having image data more
  100. accurate than your computer can display is wasteful, but it is not. 
  101. One reason is that images get passed around to users of different
  102. machines, and the more accurate the image data, the better each
  103. machine will be able to display it.  You can also do things like
  104. print color images to a color printer even though you have no color
  105. display on your computer.  Lastly, hardware to display images as
  106. accurately as Piclab stores them does exist, and is becoming more
  107. affordable every day.  If you keep your images stored in their full
  108. accuracy, you will be better able to take advantage of any new
  109. hardware you may get.
  110.  
  111.  
  112.  
  113. General Operation
  114. =================
  115.  
  116. After starting Piclab by typing "PL" at the system command line, the
  117. user may enter any of a number of commands, each of which is
  118. performed immediately.
  119.  
  120. If you give arguments to the PL command, the first is taken as the
  121. name of a file containing Piclab commands, and the rest are treated
  122. as arguments to that program, accessed as %1, %2, etc., much like DOS
  123. batch file arguments.  This feature can be used to create programs
  124. for specific tasks.
  125.  
  126. Commands generally operate on two internal picture buffers called OLD
  127. and NEW.  Most commands start by deleting OLD and renaming NEW to
  128. OLD.  They then perform some transformation on OLD storing the result
  129. in NEW.  The command UNDO swaps NEW and OLD--effectively reversing
  130. the last operation.
  131.  
  132. OLD and NEW are stored on disk.  This decision was made primarily
  133. because my taste in pictures is better than my budget for RAM.  If
  134. you are dealing with simpler pictures, or if you have RAM to burn,
  135. you can direct Piclab to store OLD and NEW on a RAMdisk.  In MSDOS
  136. and similar operating systems, this is done by typing "SET TMP=D:" at
  137. the system command line before running Piclab, where D: is the drive
  138. or directory specification of the RAMdisk.
  139.  
  140. Piclab can read and write images in different file formats.  The LOAD
  141. command is used to read an image in one of these formats into the
  142. edit buffers.  The SAVE is used to write the contents of the edit
  143. buffers into one of these formats.  Every session with Piclab will
  144. generally begin with a LOAD, and end with a SAVE (or perhaps a PRINT)
  145. with some processing in between.  A file may be loaded from one file
  146. format and saved in a different one, thereby converting among formats.
  147.  
  148. Command parsing in Piclab is roughly like that of the system command
  149. line.  The line is broken into words that must be separated by
  150. spaces; the first word specifies the actual command and the remaining
  151. words are passed to the command handler as arguments.  The individual
  152. command-handling routines are responsible for interpreting their
  153. arguments.  Generally, a word may be shortened as long as it does not
  154. conflict with any other word in the same context. For example, the
  155. LIST COMMANDS command may be abbreviated LIS COM.
  156.  
  157. Any words in the command line that begin with the '%' character are
  158. replaced as follows: if the remainder of the word is a number, the
  159. word is replaced with the argument to the PL command in that position
  160. (starting with 0).  Otherwise, the word is replaced with the value of
  161. the DOS environment variable named by the word.  For example, here is
  162. a short Piclab program (named V2E) to convert a VGA 256-color image
  163. into an EGA 16-color image:
  164.  
  165. GLOAD %1
  166. UNMAP
  167. RESCALE 640 350
  168. EGAPAL
  169. MAP
  170. GSAVE %2
  171.  
  172. With this program in the current directory, typing "PL V2E IMG1 IMG2"
  173. will load IMG1.GIF, convert it to 16-color ega, and save that to
  174. IMG2.GIF.
  175.  
  176. Piclab has many settings that can be changed to accommodate the
  177. user's needs or environment.  From within Piclab, these are set with
  178. the SET command.  Because many of these will need to be set
  179. identically each time Piclab is run, a mechanism is proved for
  180. putting initial settings into a startup file.
  181.  
  182. This file, called SSTOOLS.INI, must be in a directory pointed to by
  183. the environment variables INIT or PATH.  It is a plain text file that
  184. contains initial settings and preferences for many of the Stone Soup
  185. tools.  Here is a sample of a typical SSTOOLS.INI file:
  186.  
  187.     [fractint]
  188.  
  189.     logmap=yes
  190.     sound=off
  191.     warn=yes
  192.  
  193.     [piclab]
  194.  
  195.     display=vga1
  196.     fileformat=gif
  197.     picdir=e:/gallery
  198.     multiimage=off
  199.     multimap=off
  200.     printfile=pd
  201.     printer=paintjet
  202.     helpfile=c:/etc/pl.hlp
  203.  
  204. Note that sections for each tool are marked by a line containing only
  205. the tool's name in square brackets.  The lines in the Piclab section
  206. can contain any variable normally set by the SET command, but note
  207. the different syntax: there is no SET, and the variable name and
  208. value are separated by an = sign rather than a space.
  209.  
  210.  
  211.  
  212. Commands
  213. ========
  214.  
  215. MAKEPAL
  216.  
  217. Syntax: MAKEPAL
  218.  
  219. Makes a palette appropriate for the NEW buffer.  Operates on only
  220. true-color images.  The variable PALETTE determines the number of
  221. colors in the new map, and the MAKEPAL command picks that many colors
  222. to best fit those in the image.
  223.  
  224. The MAP command must be used to map the image onto the palette.
  225.  
  226.  
  227. EGAPAL
  228.  
  229. Syntax: EGAPAL
  230.  
  231. Makes a 16-of-64-color palette appropriate for the NEW buffer.
  232. Operates on only true-color images.  This is designed primarily for
  233. reducing full-color images to a form better suited for display on
  234. an IBM EGA or similar device.
  235.  
  236. The MAP command must be used to map the image onto the palette.
  237.  
  238.  
  239. MAP
  240.  
  241. Syntax: MAP
  242.  
  243. Maps NEW buffer onto the current palette.  Operates only on true-color
  244. images, and produces a color-mapped image.  The variable DITHER
  245. determines whether each pixel is simply mapped onto the nearest color
  246. in the map, or whether dithering is used to achieve a more accurate
  247. mapping.  DITHER defaults to ON, and is recommended for most uses.
  248.  
  249. The MAKEPAL command should be used to create the best possible palette
  250. for the image before mapping, but any palette may be used for special
  251. purposes such as mapping several images to the same palette.
  252.  
  253.  
  254. PLOAD
  255.  
  256. Syntax: PLOAD file [offset [count]]
  257.  
  258. Loads a MAP file into the current palette.  First argument is the name
  259. of the MAP file which is assumed to be in the MAPDIR directory.  If a
  260. second argument is given, the palette is loaded starting at that index.
  261. If a third argument is given, only that many colors are loaded.
  262.  
  263. MAP files are plain text files that contain the RGB values for each
  264. palette index on one line.
  265.  
  266.  
  267. PSAVE
  268.  
  269. Syntax: PSAVE file [offset [count]]
  270.  
  271. Saves a MAP file from the current palette.  First argument is the name
  272. of the MAP file which is assumed to be in the MAPDIR directory.  If a
  273. second argument is given, the palette is loaded starting at that index.
  274. If a third argument is given, only that many colors are loaded.
  275.  
  276. This can be used to save a palette created with MAKEPAL so that it need
  277. not be calculated again, or so that it can be used with other images.
  278.  
  279. MAP files are plain text files that contain the RGB values for each
  280. palette index on one line.
  281.  
  282.  
  283. GRAYPAL
  284.  
  285. Syntax: GRAYPAL file [offset [count]]
  286.  
  287. Makes the specified MAP file the default colors used when displaying
  288. monochrome images or full-color images on a VGA.  The default colors
  289. are equivalent to GAMMA1.MAP, but GAMMA2.MAP and PSEUDO.MAP can be
  290. useful in some situations.
  291.  
  292. MAP files are plain text files that contain the RGB values for each
  293. palette index on one line.
  294.  
  295.  
  296. UNMAP
  297.  
  298. Syntax: UNMAP
  299.  
  300. Produces a true-color image from a color-mapped one.  This must be done
  301. before applying true-color transformations such as rescaling.  After
  302. transformations have been performed in true-color, the image may be
  303. reduced to a color-mapped one again with the MAKEPAL and MAP commands.
  304.  
  305.  
  306. HELP
  307.  
  308. Syntax: HELP [subject]
  309.  
  310. Looks like you have figured this one out already.
  311.  
  312.  
  313. CALL
  314.  
  315. Syntax: CALL program [args]...
  316.  
  317. Calls the external program named by its first argument passing along
  318. any subsequent arguments to that program.  Many programs do not
  319. release all of the memory given to them when they terminate, so
  320. Piclab will reserve a large portion of memory for itself before
  321. calling a program.  If you do not have much more memory than Piclab
  322. reserves, this may result in the program not being able to run in the
  323. memory left.
  324.  
  325. If this is a problem, you can use the DOS or SHELL commands to exit
  326. to DOS with all of the free memory available.
  327.  
  328.  
  329. CANCEL
  330.  
  331. Syntax: CANCEL
  332.  
  333. Cancels the most recent operation.  If there are point
  334. transformations pending that have not yet been saved with the
  335. TRANSFORM command, these are cancelled and no changes are made to the
  336. edit buffers.  Otherwise, the NEW and OLD buffers are exchanged.
  337.  
  338. There are some operations (like SAVE) that do not alter the edit
  339. buffers.  If one of these operations was the last one performed, UNDO
  340. will undo the operation before that.  No arguments.
  341.  
  342.  
  343. UNDO
  344.  
  345. Syntax: UNDO
  346.  
  347. Cancels the most recent operation.  If there are point
  348. transformations pending that have not yet been saved with the
  349. TRANSFORM command, these are cancelled and no changes are made to the
  350. edit buffers.  Otherwise, the NEW and OLD buffers are exchanged.
  351.  
  352. There are some operations (like SAVE) that do not alter the edit
  353. buffers.  If one of these operations was the last one performed, UNDO
  354. will undo the operation before that.  No arguments.
  355.  
  356.  
  357. SHELL
  358.  
  359. Syntax: SHELL [command]
  360.  
  361. Calls up the DOS command line.  All available memory is released to
  362. DOS when this command is given, and is reclaimed when DOS is exited.
  363. For this reason, some programs that cannot be CALLed may be run from
  364. with DOS.
  365.  
  366. Any arguments to this command will be passed to the system as a
  367. command line, and will cause it to return immediately after the
  368. command is done.  One particularly useful action of this program is
  369. "SHELL COPY /B PDAT PRN", which copies the print file to the printer.
  370. "SHELL DIR" can be used to view file directories when you want to see
  371. all files, not just pictures.
  372.  
  373.  
  374. DOS
  375.  
  376. Syntax: DOS [command]
  377.  
  378. Calls up the DOS command line.  All available memory is released to
  379. DOS when this command is given, and is reclaimed when DOS is exited.
  380. For this reason, some programs that cannot be CALLed may be run from
  381. with DOS.
  382.  
  383. Any arguments to this command will be passed to the system as a
  384. command line, and will cause it to return immediately after the
  385. command is done.  One particularly useful action of this program is
  386. "DOS COPY /B PDAT PRN", which copies the print file to the printer.
  387. "DOS DIR" can be used to view file directories when you want to see
  388. all files, not just pictures.
  389.  
  390.  
  391. QUIT
  392.  
  393. Syntax: QUIT [flag]
  394.  
  395. Exits Piclab.  If there is a point transformation pending, it must be
  396. cancelled or saved before exiting.  If the exit command is given any
  397. arguments, it exits immediately regardless of pending transformations.
  398.  
  399. Inside a program, QUIT merely sets a flag so that Piclab will exit after
  400. the program is complete.
  401.  
  402.  
  403. EXIT
  404.  
  405. Syntax: EXIT [flag]
  406.  
  407. Exits Piclab.  If there is a point transformation pending, it must be
  408. cancelled or saved before exiting.  If the exit command is given any
  409. arguments, it exits immediately regardless of pending transformations.
  410.  
  411. Inside a program, EXIT merely sets a flag so that Piclab will exit after
  412. the program is complete.
  413.  
  414.  
  415. LIST
  416.  
  417. Syntax: LIST [item]
  418.  
  419. If given without an argument, shows what things may can be listed.
  420. If one of these things (e.g. FORMATS, COMMANDS, BUFFERS) is given as
  421. an argument, the appropriate items are listed.  Especially useful are
  422. LIST COMMANDS if you forget the name of a command you are looking for
  423. and LIST BUFFERS to check the size and format of the image in the OLD
  424. and NEW edit buffers.
  425.  
  426.  
  427. PAUSE
  428.  
  429. Syntax: PAUSE [time]
  430.  
  431. With no arguments, Piclab waits for a key to be pressed before
  432. continuing.  If one argument is given, Piclab waits for that number
  433. of seconds (but will break early if a key is pressed).  This is for
  434. use within programs.
  435.  
  436.  
  437. PRINT
  438.  
  439. Syntax: PRINT [x-offset [y-offset]]
  440.  
  441. Prints the image in the NEW buffer into the file specified by the
  442. PRINTFILE variable.  The current setting of the PRINTER variable
  443. determines what codes are sent to the file.
  444.  
  445. For hard-to-explain reasons, the current release of Piclab does not
  446. allow the use of a device name such as PRN in the PRINTFILE
  447. variable.  Images must therefore be printed to disk and copied to the
  448. printer with DOS.
  449.  
  450. If arguments are given, the first two are used as the X and Y offsets
  451. of the first dot to print on the first page of output.
  452.  
  453.  
  454. RUN
  455.  
  456. Syntax: RUN program [args...]
  457.  
  458. Takes one argument--the name of a text file containing Piclab
  459. commands.  These are interpreted as if they had been typed from the
  460. command line, but they are not echoed, and messages are turned off
  461. while a program runs.  Subsequent arguments are passed along to the
  462. program as %1, etc.
  463.  
  464. A program can also be run by giving its name as an argument to the PL
  465. command when starting Piclab.
  466.  
  467.  
  468. SHOW
  469.  
  470. Syntax: SHOW [x-offset [y-offset]]
  471.  
  472. Used to display as much of the image in the NEW buffer as will fit on
  473. the computer's display screen.  If arguments are given, the first is
  474. used as a horizontal offset into the image buffer and the second as a
  475. vertical offset.  This can be used to look at different parts of an
  476. image too big for the screen.  Certain video modes allow scrolling
  477. with the arrow keys, but not all.  If no arguments are given, the
  478. current values of the XORIGIN and YORIGIN variables are used.
  479.  
  480. If any point transformations are pending, the image you see on screen
  481. reflects the image as it would be AFTER the pending transformation.
  482. This can be used to look at the effect of a transformation before
  483. saving or cancelling it.
  484.  
  485. Because Piclab often stores data more accurately than the display can
  486. render it, what you see on the screen is only an approximation of the
  487. actual image.  In particular, because Piclab does not yet support any
  488. true-color display hardware, true-color images will be shown in grayscale
  489. on displays capable of it, or in 8-color dither on others.
  490.  
  491.  
  492. SET
  493.  
  494. Syntax: SET [variable [value]]
  495.  
  496. Without any arguments, lists all Piclab variables and their current
  497. values.  Variables can be numbers, character strings, or TRUE/
  498. FALSE.  Variables set system defaults and control the specifics of
  499. how many commands perform.
  500.  
  501. If the set command is given one argument, the variable named is
  502. cleared.  That is, set to 0 if it is numeric, to "" if it is a
  503. string, and to FALSE if it is TRUE/FALSE.
  504.  
  505. If SET is given with two arguments, the variable named by the first
  506. is set to the value specified by the second.  If a numeric variable
  507. is given a string value, it is set to 0.  String values should not be
  508. put in quotes.  TRUE/FALSE values may be set by the keywords
  509. TRUE/FALSE, YES/NO, ON/OFF, or by the numeric values 1/0.
  510.  
  511. Within the SSTOOLS.INI file, the syntax is <variable>=<value>.
  512.  
  513. Help on individual variables is available by typing HELP <variable>.
  514.  
  515.  
  516. HISTOGRAM
  517.  
  518. Syntax: HISTOGRAM [RED | GREEN | BLUE]...
  519.  
  520. If no arguments are given, plots histograms for all planes; if one or
  521. more arguments are given, a histogram is plotted for each plane
  522. specified as an argument.  The histograms plotted reflect the image
  523. as it would be after any pending transformations, so you can look at
  524. the results of many processes before saving or cancelling them.
  525.  
  526. Each vertical bar of the histogram represents the total number of
  527. pixels in the image with values in the range beginning with the value
  528. listed below the histogram in hexadecimal.  Each bar covers a range
  529. of four values and there are 64 bars.  The height of each bar is in
  530. logarithmic proportion to the frequency of occurrence of values in
  531. the range it represents.  The bars are automatically scaled so that
  532. the tallest one is made 20 characters high.
  533.  
  534.  
  535. NEGATE
  536.  
  537. Syntax: NEGATE [RED | GREEN | BLUE]...
  538.  
  539. Arguments are handled as in HISTOGRAM.  Inverts each value in the
  540. lookup table for the planes specified.  This can be used after
  541. digitizing a negative or for special effects.
  542.  
  543.  
  544. DARKEN
  545.  
  546. Syntax: DARKEN [[RED | GREEN | BLUE] value]...
  547.  
  548. Subtracts a constant value to each point in the planes specified.  If
  549. only one argument is given, all planes are brightened by that amount.
  550. Otherwise, arguments are interpreted in order, and any arguments that
  551. specify planes determine which plane the next numerical argument will
  552. affect.  For example, DARKEN RED 10 BLUE 15 would subtract 10 from
  553. the values in the red plane and 15 from those in the blue.  Any
  554. values that would be taken out of the 0..255 range by the transform
  555. are clamped.
  556.  
  557. Because this darkening is a linear operation, the image to be
  558. brightened or darkened should be encoded with a gamma of 1.0.  That
  559. is, there should be a linear relationship between values in the image
  560. and intensities on the display.  If this is not the case, gamma
  561. correction may be applied with the GAMMA command before adjusting
  562. brightness.
  563.  
  564.  
  565. BRIGHTEN
  566.  
  567. Syntax: BRIGHTEN [[RED | GREEN | BLUE] value]...
  568.  
  569. Adds a constant value to each point in the planes specified.  If only
  570. one argument is given, all planes are brightened by that amount.
  571. Otherwise, arguments are interpreted in order, and any arguments that
  572. specify planes determine which plane the next numerical argument will
  573. affect.  For example, BRIGHTEN RED 10 BLUE 15 would add 10 to the
  574. values in the red plane and 15 to those in the blue.  Any values that
  575. would be taken out of the 0..255 range by the transform are clamped.
  576.  
  577. Because this brightening is a linear operation, the image to be
  578. brightened or darkened should be encoded with a gamma of 1.0.  That
  579. is, there should be a linear relationship between values in the image
  580. and intensities on the display.  If this is not the case, gamma
  581. correction may be applied with the GAMMA command before adjusting
  582. brightness.
  583.  
  584.  
  585. CONTRAST
  586.  
  587. Syntax: CONTRAST [[RED | GREEN | BLUE] value]...
  588.  
  589. This stretches or squeezes the contrast of an image.  Arguments are
  590. interpreted like those in BRIGHTEN.  If a given value is positive,
  591. the image contrast is stretched so that values that were equal to the
  592. given value become 0, and those that were equal to (255-value) become
  593. 255.  If the given value is negative, the inverse operation is
  594. performed.  Because contrast is always stretched equally around the
  595. midpoint of the range, it is a good idea to brighten or darken an
  596. image as necessary to center its histogram before performing a
  597. contrast stretch.
  598.  
  599. Also, the contrast stretching formula operates on color values
  600. assuming a linear relationship between these values and the
  601. intensities they represent (as do the BRIGHTEN and DARKEN commands). 
  602. Therefore, if an image has been scanned with a device with a gamma
  603. value not equal to 1.0, the image should be gamma corrected before
  604. contrast stretching.
  605.  
  606.  
  607. GAMMA
  608.  
  609. Syntax: GAMMA [[RED | GREEN | BLUE] value]...
  610.  
  611. The color values of the specified planes are adjusted so that values
  612. encoded for display on a monitor with a gamma value equal to the
  613. argument become linear.
  614.  
  615. For example, images encoded for display on PCs usually expect a
  616. monitor with a gamma near 2.0.  The GAMMA 2.0 command will convert
  617. these values to a linear scale.
  618.  
  619. Images encoded on Macintoshes and similar equipment have linear
  620. values already.  Such images can be adjusted for display on PCs with
  621. the inverse transformation, i.e. GAMMA 0.5.
  622.  
  623. See Piclab.DOC for more background on gamma correction.
  624.  
  625.  
  626. COLOR
  627.  
  628. Syntax: COLOR [mapfile]
  629.  
  630. Converts a grayscale image into a color-mapped image.  If the first
  631. argument is the name of a MAP file, the image is pseudo-colored with
  632. that map, otherwise the color map will contain the original grays.
  633.  
  634.  
  635. GRAY
  636.  
  637. Syntax: GRAY
  638.  
  639. Converts true-color or color-mapped image to grayscale.  The formula
  640. used for conversion to grayscale is the same as used by black and
  641. white televisions and is designed to mimic the eye's response: gray =
  642. (.287 * red) + (.589 * green) + (.114 * blue).
  643.  
  644.  
  645. TRANSFORM
  646.  
  647. Syntax: TRANSFORM
  648.  
  649. Saves the result of a series of point-process transformations to the
  650. edit buffer.  This must be done before any other transformation may
  651. be performed on the image.  If you wish to cancel the pending
  652. transformations without saving them, use UNDO or CANCEL.
  653.  
  654.  
  655. MEDIAN
  656.  
  657. Syntax: MEDIAN [WEIGHTED]
  658.  
  659. Reduces spot noise in an image.  Each point is replaced by the median
  660. of the points in its 3 x 3 area.  That is, the nine points in this
  661. area are sorted and the fifth one is taken.  If the one argument to
  662. this routine is WEIGHTED, then the center point is added twice more
  663. to the list and the sixth of the 11 points is taken.
  664.  
  665. The median filter results in some smoothing, but not as much as with
  666. the SMOOTH command.  This effect is a little less drastic with the
  667. weighted median filter.  Repeated application of this operation will
  668. result in an oil-paint texture appearing on the image.
  669.  
  670. This filter will not help reduce periodic or other noise--only small
  671. spot noise such as from dust on a lens.
  672.  
  673.  
  674. SHARPEN
  675.  
  676. Syntax: SHARPEN [value]
  677.  
  678. Applies what is called (somewhat inaccurately) a LaPlace transform to
  679. the image.  The effect is that edges in the image are sharpened as if
  680. the image had been re-focused.  Unfortunately, it also increases the
  681. amount of noise in the image, making it appear more grainy.
  682.  
  683. The command can be given a single numerical argument, which specifies
  684. the severity of the transform.  It is basically a tradeoff between
  685. sharpness and noise, and defaults to 1.0.  This value provides a
  686. noticeable increase in both sharpness and noise, and is about the
  687. best value for sharpening when the purpose is to bring out
  688. information.  When applying to a real image, a less severe value of
  689. .2 to .5 is often better.  Values greater than 1.0 should be used
  690. only when trying to locate specific objects in an image.  They
  691. produce too much noise for accurate reproduction.
  692.  
  693. This function works by amplifying the differences between each point
  694. and its neighbors.  This has the effect of amplifying high spatial
  695. frequency details such as edges and noise.
  696.  
  697.  
  698. SMOOTH
  699.  
  700. Syntax: SMOOTH [value]
  701.  
  702. Replaces each point with the average of the values of the nine points
  703. in its neighborhood.  This has the effect of smoothing the image and
  704. reducing high frequency effects like aliasing and noise, as well as
  705. high frequency details.  If an argument is given, it is taken as a
  706. value of the severity of the transform as with the SHARPEN command. A
  707. value of 1.0 is exactly as described.  Values less than 1.0 change
  708. the center value less than if a straight average had been done. 
  709. Values greater than 1.0 are not recommended.  If more smoothing is
  710. desired, perform SMOOTH more than once rather than with a high value.
  711.  
  712.  
  713. ADD
  714.  
  715. Syntax: ADD [WRAP]
  716.  
  717. Adds the OLD and NEW edit buffers storing the result in the NEW
  718. buffer.  If the only argument to the command is WRAP, then values
  719. that are taken out of the 0..255 range by the addition are taken mod
  720. 255; otherwise, values are clamped.
  721.  
  722.  
  723. SUBTRACT
  724.  
  725. Syntax: SUBTRACT [WRAP]
  726.  
  727. Subtracts the NEW edit buffers from the OLD buffer storing the result
  728. in the NEW buffer.  If the only argument to the command is WRAP, then
  729. values that are taken out of the 0..255 range by the addition are
  730. taken mod 255; otherwise, values are clamped.
  731.  
  732.  
  733. AVERAGE
  734.  
  735. Syntax: AVERAGE
  736.  
  737. Averages the OLD and NEW buffers, storing the result in NEW.  This
  738. can be used to reduce random digitizer noise by averaging the results
  739. of different samplings.  Can also be used to produce a double exposure
  740. effect when two different images are averaged.  No arguments.
  741.  
  742.  
  743. CLIP
  744.  
  745. Syntax: CLIP [x-size y-size]
  746.  
  747. If no arguments are given, image is clipped from (XORIGIN,YORIGIN) to
  748. lower right corner (upper right for bottom-up images).  If two
  749. arguments are given, the image is clipped from (XORIGIN,YORIGIN) to
  750. the horizontal and vertical size specified by the arguments.  XORIGIN
  751. and YORIGIN are set to 0 after this operation.  One argument is an
  752. error; more than two are ignored.
  753.  
  754.  
  755. EXPAND
  756.  
  757. Syntax: EXPAND x-size y-size [(BLACK | WHITE | value) [value]...]
  758.  
  759. This command increases the size of the image to the width and height
  760. specified by its first two arguments by adding extra rows and columns
  761. of pixels.  If a third argument is given, it can be either BLACK or
  762. WHITE to indicate what color the extra pixels should be.  If three
  763. numeric arguments are given after the bounds arguments, they are
  764. taken as the red, green, and blue value of the extra pixels. 
  765.  
  766. Multiple images can be placed in a montage by using EXPAND and
  767. OVERLAY.  Parts of an image may be joined with these functions as
  768. well, but it is not recommended for separately digitized image
  769. pieces, as no mosaicking is performed.
  770.  
  771. For color-mapped images, the third argument is treated as a color map
  772. index rather than a color value.
  773.  
  774.  
  775. MIRROR
  776.  
  777. Syntax: MIRROR
  778.  
  779. Flips the image horizontally.  No Arguments.
  780.  
  781.  
  782. OVERLAY
  783.  
  784. Syntax: OVERLAY [x-offset y-offset]
  785.  
  786. Overlays the image in the NEW buffer on top of the OLD buffer.  The
  787. image in the NEW buffer must not be larger than the image it is to
  788. overlay.  If two arguments are given, they are used as the horizontal
  789. and vertical offsets into the base image at which the overlay image
  790. is to be placed.  Otherwise, XORIGIN and YORIGIN are used.
  791.  
  792.  
  793. RESCALE
  794.  
  795. Syntax: RESCALE value | (x-size y-size)
  796.  
  797. Resamples the image at a different resolution.  This is useful for
  798. scaling images up to a larger size for printing, or for scaling them
  799. down for display.  It is recommended that image data always be saved
  800. at its original sampling resolution to preserve as much data as
  801. possible and only scaled when necessary to conform to hardware.
  802.  
  803. If only one argument is given, horizontal and vertical resolution are
  804. both increased in the given proportion.  For example, if a 320 x 240
  805. image is in the NEW buffer when the command RESCALE 1.5 is given, the
  806. NEW buffer will contain the same image at 480 x 360.
  807.  
  808. More useful, though, is the case where two arguments are present.  In
  809. this case, the arguments are treated directly as the new horizontal
  810. and vertical resolution of the image.  The transformation above could
  811. be expressed as RESCALE 360 480.  This is most often used to
  812. compensate for differing aspect ratios.  For example, a 320 x 400
  813. from an Amiga can be rescaled to 320 x 200 to be viewed on a VGA, or
  814. to 720 x 540 for printing on the HP PaintJet.
  815.  
  816. Because RESCALE interpolates color values, it cannot be used on
  817. color-mapped images.
  818.  
  819.  
  820. REVERSE
  821.  
  822. Syntax: REVERSE
  823.  
  824. Changes the storage order of an image from top-down to bottom-up or
  825. vice versa.  This is used primarily to save an image loaded from a
  826. file in one format (like PCX) to a format requiring the opposite
  827. order (like GIF).
  828.  
  829. Targa files can be stored either way, and contain information in the
  830. header specifying which way they are stored.  Thus, any image can be
  831. saved in Targa format at any time with minimal memory usage.
  832.  
  833.  
  834. ROTATE
  835.  
  836. Syntax: ROTATE value
  837.  
  838. Rotates image in 90-degree increments.  The single argument may
  839. specify 1, 2, or 3, in which case that number of clockwise 90-degree
  840. rotations are performed.  If a number >= 90 is given as the argument,
  841. the image is rotated that number of degrees (truncated to the nearest
  842. 90-degree increment).
  843.  
  844. This is very useful for rotating screen-oriented images for printing
  845. on paper.  Because this operation requires large amounts of memory
  846. for large images, it is recommended in this case to rotate the image
  847. before scaling it up to size for printing.
  848.  
  849.  
  850. DIR
  851.  
  852. Syntax: DIR [directory]
  853.  
  854. Lists all files in the PICDIR directory in the current file format.  If
  855. an argument is given, files in that directory are listed.  No other
  856. file specifications can be given.  If FILEFORMAT is set to GIF or
  857. TARGA, statistics on the files will be listed as well.
  858.  
  859.  
  860. GDIR
  861.  
  862. Syntax: GDIR [directory]
  863.  
  864. Lists only GIF files from PICDIR or from the directory given as sole
  865. argument.  Statistics are listed from each file as well.
  866.  
  867.  
  868. TDIR
  869.  
  870. Syntax: TDIR [directory]
  871.  
  872. Lists only Targa files from PICDIR or from the directory given as
  873. sole argument.  Statistics are listed from each file as well.
  874.  
  875.  
  876. LOAD
  877.  
  878. Syntax: LOAD file [args]...
  879.  
  880. Loads a file in the current file format into the NEW buffer, moving
  881. the current contents of the NEW buffer to OLD.  Any arguments are
  882. passed along to the function that handles loading for the current
  883. format and are interpreted by that routine.  The first argument is
  884. always the file to be loaded, but other arguments vary with the format.
  885.  
  886. LIST FORMATS will give you a list of all the available file formats,
  887. and HELP is available for each.
  888.  
  889.  
  890. GLOAD
  891.  
  892. Syntax: GLOAD file
  893.  
  894. Loads image in GIF format regardless of the current setting of
  895. variable FILEFORMAT.  Sole argument is filename.
  896.  
  897.  
  898. TLOAD
  899.  
  900. Syntax: TLOAD file
  901.  
  902. Loads image in Targa format regardless of the current setting of
  903. variable FILEFORMAT.  Sole argument is filename.
  904.  
  905.  
  906. RLOAD
  907.  
  908. Syntax: RLOAD file x-size y-size [COLOR | MONO]
  909.  
  910. Loads image in RAW format regardless of the current setting of
  911. variable FILEFORMAT.  The width and height of the image must be
  912. specified as the second and third arguments to RLOAD.  A fourth
  913. argument may be either of the words COLOR or MONO to specify the
  914. number of planes.  COLOR is default.
  915.  
  916. Color-mapped RAW files must be loaded as MONO, then colored with the
  917. COLOR command after the palette is loaded with PLOAD.
  918.  
  919.  
  920. SAVE
  921.  
  922. Syntax: SAVE file [args]...
  923.  
  924. Saves the image in the NEW buffer to the file specified by the first
  925. argument.  Subsequent arguments are passed along to the file save
  926. routine of the current file format.
  927.  
  928. LIST FORMATS will give you a list of all the available file formats,
  929. and HELP is available for each.
  930.  
  931.  
  932. GSAVE
  933.  
  934. Syntax: GSAVE file [INTERLACE]
  935.  
  936. Saves the NEW buffer to the file named by the first argument in GIF
  937. format regardless of the current setting of variable FILEFORMAT.  If
  938. the second argument is the word INTERLACE, image is interlaced.
  939.  
  940.  
  941. TSAVE
  942.  
  943. Syntax: TSAVE file [bits]
  944.  
  945. Saves the NEW buffer to the file named by the first argument in Targa
  946. format regardless of the current setting of variable FILEFORMAT.  If
  947. the second argument is 16, 24, or 32, it is used as the number of
  948. bits per pixel stored in the file.
  949.  
  950.  
  951. RSAVE
  952.  
  953. Syntax: RSAVE file
  954.  
  955. Saves image in RAW format regardless of the current setting of
  956. variable FILEFORMAT.  No arguments.
  957.  
  958.  
  959.  
  960. Warnings and Errors
  961. ===================
  962.  
  963. "Command arguments ignored"
  964.  
  965.     This warning occurs when you give a command more arguments than it
  966.     needs.  Review the syntax of the command for an explanation.
  967.  
  968. "Open files were closed"
  969.  
  970.     This indicates that a command halted for some reason while files
  971.     were open.  Piclab has closed the files but data may be lost.
  972.  
  973. "Probable information loss"
  974.  
  975.     This warning is very common and should be taken lightly.  It
  976.     indicates that some transformation has been performed that is not
  977.     reversible.  Most of the time, the initial image will be safely
  978.     stored in a disk file, or recoverable with UNDO, so this is
  979.     unimportant.
  980.  
  981. "Assertion failure; contact author"
  982.  
  983.     The is printed only in places I think are unreachable.  This
  984.     message indicates a serious error, and action (such as saving the
  985.     working file and exiting the program) should be taken immediately.
  986.  
  987. "Insufficient memory"
  988.  
  989.     There is not enough memory to perform the command issued with the
  990.     current environment.  This is most common in frame processes like
  991.     ROTATE, and with GIF loading with MULTIIMAGE and MULTIMAP set ON. 
  992.     In the latter case, those variables can be set to OFF before
  993.     loading.  In the former, there is not much alternative but to clip
  994.     the image to a smaller size or try to provide more memory.
  995.  
  996. "Miscellaneous file I/O"
  997.  
  998.     File open or write failed.  Could be bad or full disk.  Retrying
  999.     may help.
  1000.  
  1001. "Unexpected end of file"
  1002.  
  1003.     File read failed.  This may occur when loading a file that is not
  1004.     encoded in the correct format, or when loading a RAW or IP file
  1005.     when the size is specified incorrectly.  CLIP may sometimes be used
  1006.     to recover.
  1007.  
  1008. "LZW compression/decompression"
  1009.  
  1010.     Usually the result of a bad GIF file.
  1011.  
  1012. "Unrecognized file format or bad file"
  1013.  
  1014.     The LOAD command encountered something in the file not consistent
  1015.     with the file format being loaded.  Usually this is because you
  1016.     specified the wrong format, but may also occur on a bad or
  1017.     incorrectly encoded file.
  1018.  
  1019. "Image buffer empty"
  1020.  
  1021.     You attempted a transformation when no image is in the edit
  1022.     buffers.
  1023.  
  1024. "Point transform pending; issue TRANSFORM command"
  1025.  
  1026.     The command you issued cannot be performed until any pending point
  1027.     transformations are either saved with the TRANSFORM command or
  1028.     cancelled with the UNDO command.
  1029.  
  1030. "Illegal parameter values"
  1031.  
  1032.     This is a catch-all command syntax error.  Review the syntax of
  1033.     the command you are issuing.
  1034.  
  1035. "File not found"
  1036.  
  1037.     File open in LOAD command failed.  Check that the file is in the
  1038.     proper directory by issuing a DIR command.  Also check for correct
  1039.     spelling.
  1040.  
  1041.  
  1042.  
  1043. Acknowledgements
  1044. ================
  1045.  
  1046. Though I wrote 90% of the code, this project was definitely a group
  1047. effort.  The Graphics Support Forum Developer's Group on CompuServe
  1048. was instrumental in helping to inspire, create, optimize and test
  1049. this program.  I cannot acknowledge them all (or even name them all)
  1050. but a few deserve special mention:
  1051.  
  1052. John Bridges' Image Tools package served as an inspiration and a
  1053. performance yardstick for many of this program's functions, and some
  1054. of his generously donated code appears in the display code.  John is
  1055. the author of the GRASP animation package.
  1056.  
  1057. Bert Tyler, Timothy Wegner, and the rest of the Stone Soup Group
  1058. inspired several features and did some testing as well.
  1059.  
  1060. John Swenson, who knows more about how to use the program than even
  1061. I do, provided invaluable insights.
  1062.  
  1063. 'GIF' and 'Graphics Interchange Format' are trademarks of CompuServe
  1064. Incorporated, an H&R Block company.
  1065.  
  1066.  
  1067.  
  1068. Author
  1069. ======
  1070.  
  1071. Lee Daniel Crocker
  1072. 5506 Camden Ave #D3
  1073. San Jose, CA  95124
  1074.  
  1075. The best way to reach me is to type GO PICS on CompuServe and leave
  1076. mail to user ID [73407,2030].  I read these messages two or three
  1077. times a week.
  1078.  
  1079. I am also reachable on Usenet as "lee@mport.com" (uunet!mport!lee).
  1080.